package com.ngkj.zmfptCommon.common.bean;

import com.ngkj.zmfptCommon.common.util.ResultEnum;

/**
 * @author ChenHN
 * @since 2021/10/26 creation
 **/
public class CommonReslut<T>{
    private String message;
    private int code;
    private T data;

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public CommonReslut(){

    }

    public CommonReslut(String message, int code) {
        this.message = message;
        this.code = code;
        this.data = null;
    }

    public CommonReslut(ResultEnum resultEnum,T data){
        this.message = resultEnum.getMessage();
        this.code = resultEnum.getCode();
        this.data = data;
    }

    public CommonReslut(ResultEnum resultEnum){
        this.message = resultEnum.getMessage();
        this.code = resultEnum.getCode();
        this.data = null;
    }

    public CommonReslut(String message, int code, T data) {
        this.message = message;
        this.code = code;
        this.data = data;
    }

    @Override
    public String toString() {
        return "CommonReslut{" +
                "message='" + message + '\'' +
                ", code=" + code +
                ", data=" + data +
                '}';
    }
}
